<html>
<head><meta charset="utf-8"><title>Regressions/issues with huge stack arrays on huge stacks · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html">Regressions/issues with huge stack arrays on huge stacks</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="230080021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230080021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230080021">(Mar 12 2021 at 18:56)</a>:</h4>
<p>In the course of answering someone's question about huge stack arrays, I experimented with creating a thread that had a 5GB stack size (using <code>std::thread::Builder::stack_size</code>), and then creating a huge array on the stack. In doing so, I ran into several different unusual issues, at least some of which seem like regressions from stable to nightly. Some of them look like unusual code generation issues, possibly cases where something is truncating or incorrectly sign-extending a value.</p>



<a name="230080079"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230080079" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230080079">(Mar 12 2021 at 18:56)</a>:</h4>
<p>The base test program looks like this:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">fn</span> <span class="nf">func</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">const</span><span class="w"> </span><span class="n">CAP</span>: <span class="kt">usize</span> <span class="o">=</span><span class="w"> </span><span class="n">std</span>::<span class="kt">u32</span>::<span class="n">MAX</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="kt">usize</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">x</span>: <span class="p">[</span><span class="kt">u8</span><span class="p">;</span><span class="w"> </span><span class="n">CAP</span><span class="p">]</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">[</span><span class="mi">0</span><span class="p">;</span><span class="w"> </span><span class="n">CAP</span><span class="p">];</span><span class="w"></span>
<span class="w">    </span><span class="n">x</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">123</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="fm">println!</span><span class="p">(</span><span class="s">"{}"</span><span class="p">,</span><span class="w"> </span><span class="n">x</span><span class="p">[</span><span class="mi">2</span><span class="p">]);</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">std</span>::<span class="n">thread</span>::<span class="n">Builder</span>::<span class="n">new</span><span class="p">()</span><span class="w"></span>
<span class="w">        </span><span class="p">.</span><span class="n">stack_size</span><span class="p">(</span><span class="mi">5</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="mi">1024</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="mi">1024</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="mi">1024</span><span class="p">)</span><span class="w"></span>
<span class="w">        </span><span class="p">.</span><span class="n">spawn</span><span class="p">(</span><span class="n">func</span><span class="p">)</span><span class="w"></span>
<span class="w">        </span><span class="p">.</span><span class="n">unwrap</span><span class="p">()</span><span class="w"></span>
<span class="w">        </span><span class="p">.</span><span class="n">join</span><span class="p">()</span><span class="w"></span>
<span class="w">        </span><span class="p">.</span><span class="n">unwrap</span><span class="p">();</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="230080205"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230080205" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230080205">(Mar 12 2021 at 18:57)</a>:</h4>
<p>Call that the 4GB version.<br>
I also built 2GB and 1GB versions, by changing <code>CAP</code> to <code>CAP&gt;&gt;1</code> or <code>CAP&gt;&gt;2</code> in both uses of <code>CAP</code>.</p>



<a name="230080323"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230080323" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230080323">(Mar 12 2021 at 18:58)</a>:</h4>
<p>I built that on stable in debug mode, on stable in release mode, and on nightly in release mode, and got three different results.</p>



<a name="230080372"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230080372" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230080372">(Mar 12 2021 at 18:58)</a>:</h4>
<p>On stable in release mode, it seems to work perfectly at all three sizes, and it prints 123.</p>



<a name="230080445"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230080445" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230080445">(Mar 12 2021 at 18:58)</a>:</h4>
<p>On stable in debug mode, it works fine at 1gb and 2gb, but the 4gb version prints a random different value every time (not 123).</p>



<a name="230080686"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230080686" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230080686">(Mar 12 2021 at 19:00)</a>:</h4>
<p>And on nightly in release mode, the 1GB version works fine, but the 2GB and 4GB versions both seem to allocate <em>far</em> too much, and die with a stack overflow.</p>



<a name="230080718"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230080718" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230080718">(Mar 12 2021 at 19:00)</a>:</h4>
<p>I think there are at least two separate issues going on here.</p>



<a name="230080827"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230080827" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230080827">(Mar 12 2021 at 19:01)</a>:</h4>
<p>I built all nine of those versions (stable debug, stable release, nightly release, for each of 1GB, 2GB, 4GB) and dumped the disassembly with <code>objdump -d</code>.</p>



<a name="230080904"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230080904" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230080904">(Mar 12 2021 at 19:01)</a>:</h4>
<p>I also filtered out a lot of noisy differences in LLVM symbol names with: <code>sed 's/anon[0-9a-f.]*llvm[0-9a-f.]*/anon-ELIDED-llvm-ELIDED/'</code></p>



<a name="230081004"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230081004" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230081004">(Mar 12 2021 at 19:02)</a>:</h4>
<p>Looking over the remaining differences turned up some things that seem unusual.</p>



<a name="230082421"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230082421" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230082421">(Mar 12 2021 at 19:12)</a>:</h4>
<p>For example, the diff between nightly-release 1gb and 2gb is:</p>
<div class="codehilite" data-code-language="Diff"><pre><span></span><code><span class="gd">--- nightly-release-1gb</span>
<span class="gi">+++ nightly-release-2gb</span>
<span class="gu">@@ -2468,7 +2468,7 @@</span>
 0000000000008380 &lt;_ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h12c12c27c7a85101E&gt;:
     8380:      53                      push   %rbx
     8381:      49 89 e3                mov    %rsp,%r11
<span class="gd">-    8384:      49 81 eb 00 00 00 40    sub    $0x40000000,%r11</span>
<span class="gi">+    8384:      49 81 eb 00 00 00 80    sub    $0xffffffff80000000,%r11</span>
     838b:      48 81 ec 00 10 00 00    sub    $0x1000,%rsp
     8392:      48 c7 04 24 00 00 00    movq   $0x0,(%rsp)
     8399:      00
<span class="gu">@@ -2476,7 +2476,7 @@</span>
     839d:      75 ec                   jne    838b &lt;_ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h12c12c27c7a85101E+0xb&gt;
     839f:      48 83 ec 40             sub    $0x40,%rsp
     83a3:      48 8d 5c 24 40          lea    0x40(%rsp),%rbx
<span class="gd">-    83a8:      ba ff ff ff 3f          mov    $0x3fffffff,%edx</span>
<span class="gi">+    83a8:      ba ff ff ff 7f          mov    $0x7fffffff,%edx</span>
     83ad:      48 89 df                mov    %rbx,%rdi
     83b0:      31 f6                   xor    %esi,%esi
     83b2:      ff 15 a0 07 04 00       callq  *0x407a0(%rip)        # 48b58 &lt;memset@GLIBC_2.2.5&gt;
<span class="gu">@@ -2497,12 +2497,11 @@</span>
     83ff:      00 00
     8401:      48 8d 7c 24 10          lea    0x10(%rsp),%rdi
     8406:      ff 15 7c 0a 04 00       callq  *0x40a7c(%rip)        # 48e88 &lt;_GLOBAL_OFFSET_TABLE_+0x5b0&gt;
<span class="gd">-    840c:      48 81 c4 40 00 00 40    add    $0x40000040,%rsp</span>
<span class="gd">-    8413:      5b                      pop    %rbx</span>
<span class="gd">-    8414:      c3                      retq</span>
<span class="gd">-    8415:      66 2e 0f 1f 84 00 00    nopw   %cs:0x0(%rax,%rax,1)</span>
<span class="gd">-    841c:      00 00 00</span>
<span class="gd">-    841f:      90                      nop</span>
<span class="gi">+    840c:      48 81 c4 ff ff ff 7f    add    $0x7fffffff,%rsp</span>
<span class="gi">+    8413:      48 83 c4 41             add    $0x41,%rsp</span>
<span class="gi">+    8417:      5b                      pop    %rbx</span>
<span class="gi">+    8418:      c3                      retq</span>
<span class="gi">+    8419:      0f 1f 80 00 00 00 00    nopl   0x0(%rax)</span>

 0000000000008420 &lt;_ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h3c355c4098361013E&gt;:
     8420:      48 83 ec 08             sub    $0x8,%rsp
</code></pre></div>



<a name="230082447"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230082447" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230082447">(Mar 12 2021 at 19:12)</a>:</h4>
<p>That first difference looks like a sign extension issue.</p>



<a name="230082522"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230082522" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230082522">(Mar 12 2021 at 19:13)</a>:</h4>
<p>Currently uploading all the dumps and diffs to a gist.</p>



<a name="230084355"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230084355" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230084355">(Mar 12 2021 at 19:28)</a>:</h4>
<p>Please file an issue on github</p>



<a name="230085030"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230085030" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230085030">(Mar 12 2021 at 19:33)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> Was planning to. I was hoping to characterize the problem a little more so I knew whether to file one issue or two, but if you think it'd be better, I could go ahead and file it and it can always be split further.</p>



<a name="230085316"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230085316" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230085316">(Mar 12 2021 at 19:35)</a>:</h4>
<p>Ah okay, either way you're more comfortable with. Sounds like potentially a llvm12 regression.</p>



<a name="230086073"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230086073" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> hyd-dev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230086073">(Mar 12 2021 at 19:41)</a>:</h4>
<p><span class="user-mention silent" data-user-id="239881">Josh Triplett</span> <a href="#narrow/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks/near/230080445">said</a>:</p>
<blockquote>
<p>On stable in debug mode, it works fine at 1gb and 2gb, but the 4gb version prints a random different value every time (not 123).</p>
</blockquote>
<p>"random different value" sounds problematic (I-unsound <span aria-label="boom" class="emoji emoji-1f4a5" role="img" title="boom">:boom:</span>)...</p>



<a name="230086728"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230086728" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230086728">(Mar 12 2021 at 19:46)</a>:</h4>
<p>Yeah, that was my biggest concern.</p>



<a name="230086920"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230086920" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230086920">(Mar 12 2021 at 19:48)</a>:</h4>
<p>Writing it up as a github issue now...</p>



<a name="230092513"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230092513" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> hyd-dev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230092513">(Mar 12 2021 at 20:27)</a>:</h4>
<blockquote>
<p>Sounds like potentially a llvm12 regression.</p>
</blockquote>
<p>No, I tested it and the regression can be reproduced on beta.</p>



<a name="230092562"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230092562" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230092562">(Mar 12 2021 at 20:27)</a>:</h4>
<p><span class="user-mention" data-user-id="374396">@hyd-dev</span> Does beta behave like current nightly or like current stable?</p>



<a name="230092646"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230092646" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> hyd-dev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230092646">(Mar 12 2021 at 20:28)</a>:</h4>
<p>Like current nightly, that is, stack overflows.</p>



<a name="230093797"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230093797" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230093797">(Mar 12 2021 at 20:36)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/83060">https://github.com/rust-lang/rust/issues/83060</a></p>



<a name="230095860"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230095860" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230095860">(Mar 12 2021 at 20:54)</a>:</h4>
<p><span class="user-mention" data-user-id="374396">@hyd-dev</span> Thanks for the fast analysis!</p>



<a name="230096929"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230096929" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230096929">(Mar 12 2021 at 21:01)</a>:</h4>
<p>This was an adventure. It started out with <a href="https://internals.rust-lang.org/t/u32-as-a-second-fallback-type/14219/10">this question on internals</a>, to which my thought was "you should be able to do that if you set up a thread with a huge stack", and then when I tried it, I started getting random values out.</p>



<a name="230096956"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230096956" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230096956">(Mar 12 2021 at 21:01)</a>:</h4>
<p>I'm glad I took the time to do the experiment.</p>



<a name="230097942"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230097942" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230097942">(Mar 12 2021 at 21:09)</a>:</h4>
<p>Just to confirm, it looks like the commit you tracked this down to is indeed not included in 1.50.0 stable. So that may potentially be the cause of the regression from stable to nightly. Separate from that, there's an apparent soundness bug in 1.50.0 stable. It may be that the change in nightly is masking the soundness issue in stable.</p>



<a name="230109799"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230109799" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230109799">(Mar 12 2021 at 22:26)</a>:</h4>
<p><span class="user-mention" data-user-id="239881">@Josh Triplett</span> does <a href="https://rust.godbolt.org/z/P4oaEM">https://rust.godbolt.org/z/P4oaEM</a> look similarly broken as your code using <code>format!</code>?</p>



<a name="230110102"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230110102" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230110102">(Mar 12 2021 at 22:29)</a>:</h4>
<p>If I'm looking right at this, the case that looks more broken is the 2GB one, because its thinking that there's a variable 2GB below <code>rsp</code> which already has been subtracted from..</p>



<a name="230112509"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230112509" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230112509">(Mar 12 2021 at 22:51)</a>:</h4>
<p>So, I <em>think</em> they're both wrong in different ways.</p>



<a name="230112566"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230112566" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230112566">(Mar 12 2021 at 22:52)</a>:</h4>
<p>I just posted a comment to the issue. I think for stable-debug, diffing 1gb to 2gb may be more helpful.</p>



<a name="230112594"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230112594" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230112594">(Mar 12 2021 at 22:52)</a>:</h4>
<p>1gb has large positive offsets. 2gb has large <em>negative</em> offsets that look like they've wrapped. 4gb has tiny positive offsets that look like they've truncated.</p>



<a name="230112826"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230112826" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230112826">(Mar 12 2021 at 22:55)</a>:</h4>
<p>The overflow point is just under 2gb.</p>



<a name="230112944"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230112944" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230112944">(Mar 12 2021 at 22:56)</a>:</h4>
<p>Note that if you play with diffs around that mark, you may see some of the offsets wrap and not others, because some of them are at different points in the stack.</p>



<a name="230113123"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230113123" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230113123">(Mar 12 2021 at 22:58)</a>:</h4>
<p>I think that calculation for <code>%r11</code> is here:<br>
<a href="https://github.com/rust-lang/llvm-project/blob/bbf96c9f18aa47770c4f571f714d8641ddbe86e9/llvm/lib/Target/X86/X86FrameLowering.cpp#L660-L667">https://github.com/rust-lang/llvm-project/blob/bbf96c9f18aa47770c4f571f714d8641ddbe86e9/llvm/lib/Target/X86/X86FrameLowering.cpp#L660-L667</a></p>



<a name="230113140"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230113140" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230113140">(Mar 12 2021 at 22:59)</a>:</h4>
<p>Here's a diff close to the wrap point: <a href="https://rust.godbolt.org/z/rn1bPd">https://rust.godbolt.org/z/rn1bPd</a></p>



<a name="230113379"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230113379" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230113379">(Mar 12 2021 at 23:01)</a>:</h4>
<p>(my link would only apply to inline-asm probes, so 1.51+)</p>



<a name="230113733"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230113733" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230113733">(Mar 12 2021 at 23:04)</a>:</h4>
<p><span class="user-mention" data-user-id="138448">@cuviper</span> the entire epilogue/prologue insertion &amp; frame finalization pass appears to be wrong</p>



<a name="230113976"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230113976" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230113976">(Mar 12 2021 at 23:07)</a>:</h4>
<p>yeah, I see now, it's not really the probing</p>



<a name="230114067"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230114067" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230114067">(Mar 12 2021 at 23:08)</a>:</h4>
<p>/me cooking up a llvm-ir reproducer to report upstream.</p>



<a name="230114083"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230114083" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230114083">(Mar 12 2021 at 23:08)</a>:</h4>
<p>I can't dig now, but count me interested... :)</p>



<a name="230116677"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Regressions/issues%20with%20huge%20stack%20arrays%20on%20huge%20stacks/near/230116677" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Regressions.2Fissues.20with.20huge.20stack.20arrays.20on.20huge.20stacks.html#230116677">(Mar 12 2021 at 23:40)</a>:</h4>
<p><a href="https://bugs.llvm.org/show_bug.cgi?id=49567">https://bugs.llvm.org/show_bug.cgi?id=49567</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>